AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')


function ENT:Initialize()
    local modelnumber = {
	"models/props_wasteland/rockcliff01k.mdl",
	"models/props_wasteland/rockcliff01b.mdl",
	"models/props_wasteland/rockcliff01c.mdl",
	"models/props_wasteland/rockcliff01e.mdl",
	"models/props_wasteland/rockcliff01f.mdl",
	"models/props_wasteland/rockcliff01g.mdl",
	"models/props_wasteland/rockcliff01j.mdl",
	"models/props_wasteland/rockgranite01a.mdl",
	"models/props_wasteland/rockgranite01b.mdl",
	"models/props_wasteland/rockgranite01c.mdl",
	"models/props_wasteland/rockgranite02a.mdl",
	"models/props_wasteland/rockgranite02b.mdl",
	"models/props_wasteland/rockgranite02c.mdl",
	"models/props_wasteland/rockgranite03a.mdl",
	"models/props_wasteland/rockgranite03b.mdl",
	"models/props_wasteland/rockgranite03c.mdl",
	"models/props_wasteland/rockgranite04a.mdl",
	"models/props_wasteland/rockgranite04b.mdl",
	"models/props_wasteland/rockgranite04c.mdl"}
	-- nach abschuss
	-- models/props_junk/rock001a.mdl

	self.Entity:SetModel( modelnumber[math.random( 1, table.getn(modelnumber) )] )  	
	self.mining = math.random( 100, 300 )
	self.yield =  math.random( 1, 5 )
	self.Entity:PhysicsInit( SOLID_VPHYSICS )        	
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )    	
	self.Entity:SetSolid( SOLID_VPHYSICS )                         
	local phys = self.Entity:GetPhysicsObject()  	
	if (phys:IsValid()) then  		
		phys:Wake()  	
	end  
    phys:SetMass( 50000 )
	end

function ENT:SpawnFunction( ply, tr )
	if ( !tr.Hit ) then return end
	local SpawnPos = tr.HitPos + tr.HitNormal * 36
	local ent = ents.Create( "Astroid1" )
	ent:SetPos( SpawnPos )
	ent:Spawn()
	ent:Activate()
	return ent
end
